package com.example.ercmssystem2.service;

import com.example.ercmssystem2.entity.Department;

import java.util.List;

public interface DepartmentService {

    // 创建部门
    Department createDepartment(Department department, Long createdBy);

    // 更新部门
    Department updateDepartment(Long id, Department department);

    // 删除部门（软删除）
    void deleteDepartment(Long id);

    // 获取部门详情
    Department getDepartmentById(Long id);

    // 获取所有部门
    List<Department> getAllDepartments();

    // 获取所有部门（别名方法）
    List<Department> findAllDepartments();

    // 获取部门树结构
    List<Department> getDepartmentTree();

    // 获取顶级部门
    List<Department> getTopLevelDepartments();

    // 获取子部门
    List<Department> getChildDepartments(Long parentId);

    // 获取部门管理员管理的部门
    List<Department> getDepartmentsByManager(Long managerId);

    // 设置部门管理员
    Department setDepartmentManager(Long departmentId, Long managerId);

    // 检查用户是否有部门管理权限
    boolean hasDepartmentPermission(Long userId, Long departmentId);

    // 获取用户可管理的部门
    List<Department> getUserManageableDepartments(Long userId);

    // 验证部门名称是否唯一
    boolean isDepartmentNameUnique(String name, Long excludeId);
} 